

********************************************************************************
* Analysis Code for November 2022 Humanitarian Experiment
********************************************************************************

* Paul Musgrave
* rpm47@georgetown.edu
* For Paul Musgrave and Dov Levin


* This code takes pre-cleaned data and analyzes the results for the humanitarian
* experiment.

********************************************************************************
* Stata Packages Required (Note)
********************************************************************************

/*

Replication users will need the following packages available from SSC or other
repositories

net install cleanplots, from("https://tdmize.github.io/data/cleanplots") replace

ssc install catplot

ssc install coefplot

ssc install esttab

ssc install mylabels

ssc install grc1leg

*/

********************************************************************************
* Importing Data and Stata Cruft
********************************************************************************

clear all

version 18

set more off

set scheme plotplainblind

******** EDIT DIRECTORY STRUCTURE TO FIT YOUR COMPUTER ********

global MyProject "~/Dropbox/0001 Academic Projects/Ongoing/0155 Voting Abroad Purpose/Replication/Upload/"

use "${MyProject}ProlificData.dta"

********************************************************************************
* Power Calculations
********************************************************************************
	
/// Produces Figure A1, "Humanitarian Experiment, power calcualtion"

local technical i.order i.mobile i.attention_color
local demographics age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed


reg human_main_DV_dichot1 i.humanitarian_treat_num3  `demographics' `technical' ///
		if humanitarian_treat_num3 >=1 
eststo power_mod_1

logit human_main_DV_dichot1 i.humanitarian_treat_num3  `demographics' `technical' if humanitarian_treat_num3 >=1
eststo power_mod_2

coefplot power_mod_1, keep(*.humanitarian_treat_num3) base xline(0) ///
	title("{it:OLS}") name(g_power_mod_1, replace)

coefplot power_mod_2, keep(*.humanitarian_treat_num3) base xline(0) ///
	title("{it:Logit}") name(g_power_mod_2, replace)	
	
power twoproportions (0.3(0.1)0.6), n(1000) diff(.05(.025).125) graph(yline(.8) name(g_power,replace)) 

gr combine g_power_mod_1 g_power_mod_2, rows(2) name(g_power_mod,replace)

gr combine g_power_mod g_power, rows(1)

********************
* Appendix Figure A1

gr export "${MyProject}01 Figure A1.pdf", replace

********************************************************************************
* Summary Plots and Tables
********************************************************************************
	
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Summary Table
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

/// Produces Table A2 in the appendix

/// Written before dtable, alas

tabulate gender3, generate(gender3_dum)
lab var gender3_dum1 "Gender: Female"
lab var gender3_dum2 "Gender: Male"
lab var gender3_dum3 "Gender: Alternative"

tabulate employed, generate(employed_dum)
lab var employed_dum1 "Employment: Unemployed"
lab var employed_dum2 "Employment: Not in Workforce"
lab var employed_dum3 "Employment: Full Time"
lab var employed_dum4 "Employment: Part Time"

tabulate pid3, generate(pid3_dum)
lab var pid3_dum1 "Party: Democrat"
lab var pid3_dum2 "Party: Independent"
lab var pid3_dum3 "Party: Republican"

lab var age "Age in Years"
 
estpost summarize age gender3_dum* pid3_dum* college white hispanic employed_dum* christian
est sto summarytable
	
********************
* Appendix Table A2

esttab summarytable using "${MyProject}AppendixTableA2.tex", replace ///
    cells("count(fmt(a2)) mean sd min max") label 								///
    title("Humanitarian Experiment Descriptive Statistics""\label{tab:humanitariansummary}") nonumber noobs 
	

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Balance Table 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

gen white_only = 0
replace white_only = 1 if white == 1 & hispanic == 0
lab var white_only "White Non-Hispanic"

lab var attention_color "Attentiveness"

lab var age "Age in Years"

	
********************
* Appendix Table A3

dtable age female pid3_dum* college white_only hispanic christian attention duration ///
	, by(humanitarian_treat_num3) nformat(%8.2g)								///
	export("${MyProject}AppendixTableA3.tex", replace tableonly)			///
	title("Humanitarian Experiment \label{tab:humanitarianBalance}")	
	
	
********************************************************************************
* Support for Intervention by Objective Type (H1)
********************************************************************************

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Running Models
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

*******************
* Ologit
*******************

local DV human_main_DV
local DValt human_main_DV2

* Base Models (Treatments Only)

quietly ologit `DV' i.humanitarian_treat_num
eststo human_m0_b0_olog, title("Base, Ologit")
local n1 = e(N)
quietly margins, post
est sto human_m0_b0_olog_fx

quietly ologit `DValt' i.humanitarian_treat_num
eststo human_m0_b0_olog2, title("Base, Ologit Alt")
local n1alt = e(N)
quietly margins, post
est sto human_m0_b0_olog2_fx

* Adjused Models (Include Covariates)

quietly ologit `DV' 													///
		i.humanitarian_treat_num												///
		`demographics' `technical'
eststo human_m1_olog, title("Adj, Ologit")
local n2 = e(N)
quietly margins, atmeans post
est sto human_m1_olog_fx

quietly ologit `DValt' 							 						///
		i.humanitarian_treat_num												///
		`demographics' `technical'
eststo human_m1_olog2, title("Adj, Ologit Alt")
local n2alt = e(N)
quietly margins, atmeans post
est sto human_m1_olog2_fx

********************
* Appendix Table A4

esttab human_m0_b0_olog human_m0_b0_olog2 human_m1_olog human_m1_olog2			///
	using "${MyProject}AppendixTableA4.tex"			///
	,	replace label title("Humanitarian Experiment, Ologit""\label{tab:humanitarianmainpaper}")					///
	mtitles("Base" "Base Alt DV" "Adj" "Adj Alt DV")							///
	longtable nobase eqlabels(none) drop(cut*)


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Descriptive Plots
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

* Produce Figure 1 A)

catplot  , 																		///
	over(human_main_DV_trichot, label(labsize(*.65))) 							///
	over(humanitarian_treat_num3,label(labsize(2)))								///
	asyvars stack																///
	bar(1, bcolor(ebg)) bar(2, bcolor(dimgray)) 								///
	horizontal percent(humanitarian_treat_num3) 								///
	ytitle("Percent") 															///
	blabel(bar,format(%4.1f) size(2) position(center)) 							///
	legend(position(12) rows(1)) 												///
	title("{bf:A) Support for Intervention by Treatment}")						///
	note("Control N = 477; Christian N = 533; , Muslim N = 505", size(vsmall))	///
	name(grhumanitarian_3way,replace)		

* Produce Figure 1 B)

local model1 human_m0_b0_olog
local model2 human_m0_b0_olog2
local model3 human_m1_olog
local model4 human_m1_olog2

local model1title "Base"
local model2title "Base, Alt DV"
local model3title "Adj"
local model4title "Adj, Alt DV"

local gtitle g_h1_ologit

coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			(`model4', label(`model4title')) 									///
			, title("{bf: B) Effects of Treatment on Intervention Support}")	///
			xtitle("{it: Ordinal Logistic Coefficients}")						///
			keep(*.human*) base													///
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(1) rows(42) size(small)) 						///
			ylab(,labsize(vsmall))												///
			note("`model1title' N = `n1', `model2title' N = `n1alt', `model3title' N = `n2', `model4title' N = `n2alt'"												///
			"Full specification for Adjusted includes demographic and technical covariates. Alt DVs omit 'neither' categories.", size(vsmall))


* Produce Figure 1 C)
			
est restore human_m1_olog
 margins , atmeans dydx(humanitarian_treat_num) post
est sto human_m1_olog_dydx,title("Covariates")

est restore human_m0_b0_olog
 margins , atmeans dydx(humanitarian_treat_num) post
est sto human_m0_olog_dydx,title("Base")

mylabels -10(5)10, myscale(@/100) local(myla)

coefplot (human_m1_olog_dydx, label(Base))										///
			(human_m0_olog_dydx, label(Covariates))								///
	, recast(bar) vertical barw(0.25)											///
	ciopts(recast(rcap) color(gs8)) citop										///
	xlab(	1 `""Strongly" "disapprove""' 2 "Disapprove"						///
			3 `""Somewhat" "disapprove""' 	4 "Neither" 5 `""Somewhat" "approve""' ///
			6 "Approve" 7 `""Strongly" "approve""'								///
		, labsize(vsmall)) 														///
	title("{bf: C) Differences in Predictions by Treatment, Humanitarian - Interest}", size(medsmall)) 	///
	note("Base model includes no covariates; Covariates includes technical and demographic variables.",size(small))		///
	yline(0) ylab(`myla',labsize(vsmall))									///
	name(gph_dydx_ologit, replace) 											///
	legend(rows(1) ring(2) pos(12)) 
	

********************
* Main Paper Figure 1

gr combine grhumanitarian_3way g_h1_ologit gph_dydx_ologit						///
	, rows(3) 																	///
	name(exprop_h1_main_gph,replace)

	graph display, ysize(9) xsize(6)

gr export "${MyProject}00 Main Figure 1.pdf", replace



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Subgroups
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

* * * * * * * Gender

local model1title "Female"
local model2title "Male"
local model1 human_m1_olog_female
local model2 human_m1_olog_male
local title Gender
local gtitle gph_`title'

local DV human_main_DV
local DValt human_main_DV2

* Base
quietly ologit `DV' i.humanitarian_treat_num


quietly ologit `DV' i.humanitarian_treat_num									///
		age i.white i.hispanic i.college i.hhi_num i.pid7 i.employed			///
		`technical'																///
		if female == 1
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.white i.hispanic i.college i.hhi_num i.pid7 i.employed			///
		`technical'																///
		if female == 0
eststo `model2', title(`model2title')
local n2 = e(N)

coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')), 									///
			title("{it: `title'}") 												///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(9) rows(2) size(vsmall)) 										///
			ylab(,labsize(tiny))												///
			note("`model1title' N = `n1', `model2title' N = `n2'", size(tiny))


* * * * * * * Education

local model1title "College"
local model2title "No College"
local model1 human_m1_olog_college
local model2 human_m1_olog_nocollege
local title Education
local gtitle gph_`title'

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.hhi_num i.pid7 i.employed				///
		`technical'																///
		if college == 1
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic  i.hhi_num i.pid7 i.employed			///
		`technical'																///
		if college == 0
eststo `model2', title(`model2title')
local n2 = e(N)

coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			, title("{it: `title'}") 											///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(10) rows(2) size(vsmall)) 										///
			ylab(,labsize(tiny))												///
			note("`model1title' N = `n1', `model2title' N = `n2'", size(tiny))



* * * * * * * Party ID

local model1title "Democrats"
local model2title "Independents"
local model3title "Republicans"

local model1 human_m1_olog_dem
local model2 human_m1_olog_ind
local model3 human_m1_olog_gop

local title Party
local gtitle gph_`title'

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.employed			///
		`technical'																///
		if pid3alt == 0
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.employed			///
		`technical'																///
		if pid3alt == 1
eststo `model2', title(`model2title')

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.employed			///
		`technical'																///
		if pid3alt == 2
eststo `model3', title(`model3title')
local n3 = e(N)


coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			, title("{it: `title'}") 											///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(9) rows(3) size(tiny)) 										///
			ylab(,labsize(tiny))												///
			note("`model1title' N = `n1', `model2title' N = `n2', `model3title' N = `n3'", size(tiny))

* * * * * * * Covid Exposure

local model1title "Exposed"
local model2title "Not Exposed"
local model1 human_m1_olog_covid
local model2 human_m1_olog_novid
local title Covid
local gtitle gph_`title'


quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.college i.hispanic i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if covidexposure == 1
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.college i.hispanic i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if covidexposure == 0
eststo `model2', title(`model2title')
local n2 = e(N)



coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			, title("{it: `title'}") 											///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(1) rows(2) size(vsmall)) 										///
			ylab(,labsize(vsmall))												///
			note("`model1title' N = `n1', `model2title' N = `n2'", size(tiny))



* * * * * * * * Employment

local model1title "Not Working"
local model2title "Part Time"
local model3title "Full-Time"

local model1 human_m1_olog_nojob
local model2 human_m1_olog_pt
local model3 human_m1_olog_ft

local title Employment
local gtitle gph_`title'


quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num 					///
		`technical'																///
		if employed == 0 | employed == 1
eststo `model1', title("Not in Workforce")
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num 					///
		`technical'																///
		if employed == 3
eststo `model2', title("Part Time")
local n2 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num 					///
		`technical'																///
		if employed == 2
eststo `model3', title("Full Time")
local n3 = e(N)


coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			, title("{it: `title'}") 											///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(9) rows(3) size(tiny)) 										///
			ylab(,labsize(tiny))												///
			note("`model1title' N = `n1', `model2title' N = `n2', `model3title' N = `n3'", size(tiny))

* * * * * * * * Russian intervention effectiveness


local model1title "Ineffective"
local model2title "Neither"
local model3title "Effective"

local model1 human_m1_olog_ineff
local model2 human_m1_olog_neither
local model3 human_m1_olog_effect

local title Russia
local gtitle gph_`title'


quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if russia_effect_3pt == 0
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if russia_effect_3pt == 1
eststo `model2', title(`model1title')
local n2 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if russia_effect_3pt == 2
eststo `model3', title(`model3title')
local n3 = e(N)


coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			, title("{it: `title'}") 											///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(2) rows(3) size(tiny) fcolor(%30)) 										///
			ylab(,labsize(tiny))												///
			note("`model1title' N = `n1', `model2title' N = `n2', `model3title' N = `n3'", size(tiny))

* * * * * * * * * * Hawkishness

* cut hawkishness into thirds

local model1title "Doves"
local model2title "Middle"
local model3title "Hawks"

local model1 human_m1_olog_dove
local model2 human_m1_olog_mush
local model3 human_m1_olog_hawk

local title Hawkishness
local gtitle gph_`title'


quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if hawkishcat == 0
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if hawkishcat == 1
eststo `model2', title(`model2title')
local n2 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if hawkishcat == 2
eststo `model3', title(`model3title')
local n3 = e(N)


coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			, title("{it: `title'}") 											///
			keep(*.humanitarian*) base											///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(9) rows(3) size(tiny)) 										///
			ylab(,labsize(tiny))												///
			note("`model1title' N = `n1', `model2title' N = `n2', `model3title' N = `n3'", size(tiny))

* * * * * * * * Order

local model1title "1"
local model2title "2"
local model3title "3"

local model1 human_m1_olog_1
local model2 human_m1_olog_2
local model3 human_m1_olog_3

local title Order
local gtitle gph_`title'

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if order == 1
eststo `model1', title(`model1title')
local n1 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if order == 2
eststo `model2', title(`model1title')
local n2 = e(N)

quietly ologit `DV' i.humanitarian_treat_num									///
		age i.female i.white i.hispanic i.college i.hhi_num i.pid7 i.employed	///
		`technical'																///
		if order == 3
eststo `model3', title(`model3title')
local n3 = e(N)


coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			, title("{it: `title'}") 											///
			keep(*humanitarian*) base													///
			levels(95 83 )  ciopts(lwidth(.75...) lcolor(*.4 *.9)) 				///	
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(9) rows(3) size(tiny)) 										///
			ylab(,labsize(vsmall))												///
			note("`model1title' N = `n1', `model2title' N = `n2', `model3title' N = `n3'", size(tiny))
						


********************
* Appendix Figure A2

gr combine gph_Education gph_Hawkishness gph_Employment gph_Russia gph_Covid	///
		gph_Gender gph_Party gph_Order													///
		, rows(4) title("{bf:Results by Subgroup}")								///
		subtitle("{it: Ordinal Logistic Regression Coefficients}")				///
		note("95% confidence intervals in faint lines; 83% confidence intervals in dark. Full specification includes demographic and technical covariates.",size(tiny)) ///
		xcommon
		
gr display, ysize(9) xsize(7) 
		
gr export "${MyProject}01 Figure A2.pdf", replace
		

********************************************************************************
* Selective Support for Humanitarian Intervention (H1.1)
********************************************************************************

* In-Group/Out-Group Plot
* Using models with covariates for presentation


* All
quietly ologit human_main_DV 													///
		i.humanitarian_treat_num3 												///
		`demographics' `technical' if humanitarian_treat_num3 >=1
eststo comparison_all, title("All Respondents, Ologit")
local n2 = e(N)
quietly margins, atmeans post
est sto comparison_all_fx

* Christians Only
quietly ologit human_main_DV 															///
		i.humanitarian_treat_num3 												///
		`demographics' `technical' if humanitarian_treat_num3 >=1 & christian == 1
eststo comparison_xtian, title("Christians Only, Ologit")
local n2_x = e(N)
quietly margins, atmeans post
est sto comparison_xtian_fx


* Non-Christians Only
quietly ologit human_main_DV 															///
		i.humanitarian_treat_num3 												///
		`demographics' `technical' if humanitarian_treat_num3 >=1 & christian == 0
eststo comparison_notian, title("Non-Christians Only, Ologit")
local n2_notx = e(N)
quietly margins, atmeans post
est sto comparison_notian_fx

/// Produces Figure 2 A)

coefplot 	(comparison_all, label(All)) 											///
			(comparison_xtian, label(Christians))									///
			(comparison_notian, label("Not Christians"))							///
			, title("{bf: A) Effects of Victim Identity by Respondent Identity}")	///
			xtitle("{it: Ordinal Logistic Coefficients}", size(vsmall))		///
			keep(*.human*) base													///
			name(comparison_coef,replace)  xline(0) 									///
			legend(ring(0) pos(1) rows(3) size(small)) 							///
			ylab(,labsize(vsmall))												///
			note("All  N = `n2', Christian only N = `n2_x', non-Christians N = `n2_notx'"	///
			"Full specification for includes demographic and technical covariates.", size(tiny))


**********************
* Appendix Table A5
								
esttab comparison_all comparison_xtian comparison_notian						///
	using "${MyProject}AppendixTableA5.tex"					///
	, replace label nobase	longtable	drop(cut*)								///
	title("Humanitarian In Group OutGroup Results" "\label{tab:humanitarianH2}")				///
	mtitles("All" "Christians" "Not Christians")

	
/// Produces Figure 2 B)

est restore comparison_xtian
margins, atmeans dydx(humanitarian_treat_num) post
est sto comparison_xtian_dydx, title("Christian")

est restore comparison_notian
margins, atmeans dydx(humanitarian_treat_num) post
est sto comparison_notian_dydx,title("Muslim")

est restore comparison_all 
margins, atmeans  dydx(humanitarian_treat_num) post
est sto comparison_all_dydx,title("All")

mylabels -10(5)10, myscale(@/100) local(myla)

coefplot (comparison_all_dydx, label("All Rs")) ///
		 (comparison_xtian_dydx, label("Christian Rs")) ///
		 (comparison_notian_dydx, label("Non-Christian Rs")) ///
		 , recast(bar) barw(0.15) vertical  ///
			ciopts(recast(rcap) color(gs8)) citop ///
			xlab(1 `""Strongly" "disapprove""' 2 "Disapprove" 3 `""Somewhat" "disapprove""' 	///
				4 "Neither" 5 `""Somewhat" "approve""' 6 "Approve" 7 `""Strongly" "approve""',	///
				labsize(vsmall)) 												///
		title("{bf: B) Predicted Changes in Predicted Support}", size(medsmall)) ///
		subtitle("{it:Difference in Support Moving from Christian to Muslim ID Treatments}", size(vsmall)) ///
		name(gph_dydx_xtian_ologit, replace) legend(rows(1) ring(2) pos(12)) ///
		note("All variables at sample means.", size(tiny)) ///
				yline(0) ylab(`myla',labsize(vsmall))	

**********************
* Main Paper Figure 2
			
gr combine comparison_coef gph_dydx_xtian_ologit, rows(1) 			

graph display, ysize(5) xsize(8)

gr export "${MyProject}00 Main Figure 2.pdf", replace

/*
	Additional analysis regarding Christian and Muslim treatments for the appendix.
*/

/// Appendix Figures A3 and A4

lab def religion_attend_reglab 0 "Does not attend regularly" 1 "Attends regularly"

lab val religion_attend_reg religion_attend_reglab

* * * * * * * * * * * *
* Religious Attendance		

* With Neithers	

quietly ologit human_main_DV b2.humanitarian_treat_num3##i.religion_attend_reg		///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_attend_ologit_base
local sto h2a_attend_ologit_base_N = e(N)

quietly ologit human_main_DV b2.humanitarian_treat_num3##i.religion_attend_reg		///
		`technical' `demographics'												///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_attend_ologit_cov
local h2a_attend_ologit_cov_N = e(N)

* Without Neithers 

quietly ologit human_main_DV2 b2.humanitarian_treat_num3##i.religion_attend_reg		///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_attend_ologit_base_alt
local h2a_attend_ologit_base_alt_N = e(N)

quietly ologit human_main_DV2 b2.humanitarian_treat_num3##i.religion_attend_reg		///
		`technical' `demographics'												///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_attend_ologit_cov_alt
local h2a_attend_ologit_cov_alt_N = e(N)

* Graphics (Attendance)

local model1title "Base"
local model2title "Base, Alt DV"
local model3title "Adj"
local model4title "Adj, Alt DV"
		
est restore h2a_attend_ologit_base
local model1n = e(N)

est restore h2a_attend_ologit_base_alt
local model2n = e(N)

est restore h2a_attend_ologit_cov
local model3n = e(N)

est restore h2a_attend_ologit_cov_alt
local model4n = e(N)

local gtitle g_h2a_attend_ologit

**********************
* Appendix Figure A3
			
coefplot 	(h2a_attend_ologit_base, label("Base")) 							///
			(h2a_attend_ologit_base_alt, label("Base, Alt DV")) 				///
			(h2a_attend_ologit_cov, label(Adj)) 								///
			(h2a_attend_ologit_cov_alt, label(Adj, Alt DV)) 					///
			, title("{bf: Religious Attendance and Intervention Support Among Christians}")		///
			xtitle("{it: Ordinal Logistic Coefficients}")						///
			 base																///
			 keep(*.humanitarian_treat_num3* *.religion_attend_reg)				///
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(10) rows(4) size(small)) 						///
			ylab(,labsize(vsmall))												///
			note("`model1title' N = `model1n', `model2title' N = `model2n', `model3title' N = `model3n', `model4title' N = `model4n'"												///
			"Full specification for Adjusted includes demographic and technical covariates. Alt DVs omit 'neither' categories.", size(vsmall))
			
gr export "${MyProject}01 Figure A3.pdf", replace


* * * * * * * * * * * *
* Religion Importance

* With Neithers

quietly ologit human_main_DV b2.humanitarian_treat_num3##c.religionimpt_num					///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_import_ologit_base
local h2a_import_ologit_base_N = e(N)

quietly ologit human_main_DV b2.humanitarian_treat_num3##c.religionimpt_num					///
			`technical'																///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_import_ologit_tech
local h2a_import_ologit_tech_N = e(N)
			
quietly ologit human_main_DV b2.humanitarian_treat_num3##c.religionimpt_num					///
			`technical' `demographics'												///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_import_ologit_cov
local h2a_import_ologit_cov_N = e(N)

* Without Neithers

quietly ologit human_main_DV2 b2.humanitarian_treat_num3##c.religionimpt_num				///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_import_ologit_base_alt
local h2a_import_ologit_base_alt_N = e(N)

quietly ologit human_main_DV2 b2.humanitarian_treat_num3##c.religionimpt_num				///
			`technical'																///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_import_ologit_tech_alt
local h2a_import_ologit_tech_alt_N = e(N)
			
quietly ologit human_main_DV2 b2.humanitarian_treat_num3##c.religionimpt_num				///
			`technical' `demographics'												///
			if humanitarian_treat_num3 >=1 & christian == 1
est sto h2a_import_ologit_cov_alt
local sto h2a_import_ologit_cov_alt_N = e(N)

* Graphics (Importance)

local model1 h2a_import_ologit_base
local model2 h2a_import_ologit_base_alt
local model3 h2a_import_ologit_cov
local model4 h2a_import_ologit_cov_alt

local model1title "Base"
local model2title "Base, Alt DV"
local model3title "Adj"
local model4title "Adj, Alt DV"
		
est restore `model1'
local model1n = e(N)

est restore `model2'
local model2n = e(N)

est restore `model3'
local model3n = e(N)

est restore `model4'
local model4n = e(N)

local gtitle g_h2a_import_ologit

**********************
* Appendix Figure A4

coefplot 	(`model1', label(`model1title')) 									///
			(`model2', label(`model2title')) 									///
			(`model3', label(`model3title')) 									///
			(`model4', label(`model4title')) 									///
			, title("{bf: Religious Importance and Intervention Support Among Christians}")		///
			xtitle("{it: Ordinal Logistic Coefficients}")						///
			 keep(*.humanitarian_treat_num3* religionimpt_num)					///
			base																///
			name(`gtitle',replace)  xline(0) 									///
			legend(ring(0) pos(4) rows(4) size(small)) 						///
			ylab(,labsize(vsmall))												///
			note("`model1title' N = `model1n', `model2title' N = `model2n', `model3title' N = `model3n', `model4title' N = `model4n'"												///
			"Full specification for Adjusted includes demographic and technical covariates. Alt DVs omit 'neither' categories.", size(vsmall))
	
gr export "${MyProject}01 Figure A4.pdf", replace

			
********************************************************************************
* Substitutability and Strategy Preferences (H3 and H3.1)
********************************************************************************

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Reshaping and re-cleaning data for strategies/substitutability
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

keep order mobile attention_color age female white hispanic college hhi_num 	///
			pid7 employed human_contribute* human_negotiate* human_coup* 		///
			human_concession* human_threaten* humanitarian_treat_* id
			
rename human_*_DV human_DV_ordinal_*
rename human_*_DV2 human_DV2_*
rename human_*_DV_dichot1 human_DV_dichot1_*
rename human_*_DV_dichot2 human_DV_dichot2_*
rename human_*_DV_trichot human_DV_trichot_*


reshape long human_DV_ordinal_ human_DV2_ human_DV_dichot1_ human_DV_dichot2_ 	///
		human_DV_trichot_														///
		, i(id) j(strategy,string)

rename *_ *


encode strategy, gen(strategy_num)


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Run models for each strategy
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 


forvalues i = 1/5 {
	local modtitle: label (strategy_num) `i'
	* Covariates
	local modlab "c"
	local dvlab "ordinal"
	quietly ologit human_DV_ordinal i.humanitarian_treat_num `technical' `demographics'	///
		if strategy_num == `i'
	eststo `dvlab'_`modtitle'_`modlab', title("Ordinal")	
		
}


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Graph the five models (coefplot)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

		local model1 ordinal_concession_c
		local model2 ordinal_negotiate_c
		local model3 ordinal_contribute_c
		local model4 ordinal_coup_c
		local model5 ordinal_threaten_c
		
		local model1title "Concession After"
		local model2title "Concession Before"
		local model3title "Contribute"
		local model4title "Encourage Coup"
		local model5title "Sanctions"
		
		
		
		est restore `model1'
		local model1n = e(N)

		est restore `model2'
		local model2n = e(N)
		
		est restore `model3'
		local model3n = e(N)

		est restore `model4'
		local model4n = e(N)

		est restore `model5'
		local model5n = e(N)
		
	coefplot 																	///
				(`model1', label(`model1title' (`model1n'))) 					///
				(`model2', label(`model2title' (`model2n'))) 					///
				(`model3', label(`model3title' (`model3n'))) 					///
				(`model4', label(`model4title' (`model4n'))) 					///
				(`model5', label(`model5title' (`model5n'))) 					///
				, title("{bf: B) Effects of Treatment on Option Support}", size(medsmall) span)		///
				xtitle("{it:Ologit Coefficients}",size(small))								///
				keep(*.human*) base	xline(0)									///
				legend(ring(0) pos(2) rows(5) size(small)) 						///
				note("Ns in parentheses. Full specification includes demographic and technical covariates.", size(tiny))		///
			name(ologitcoef_small,replace)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Substantive Plots (DYDX)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

est restore ordinal_threaten_c
 margins , atmeans dydx(humanitarian_treat_num) post
 eststo ordinal_threaten_c_dydx, title("Threaten")
 	
est restore ordinal_contribute_c
 margins , atmeans dydx(humanitarian_treat_num) post
 eststo ordinal_contribute_c_dydx, title("Contribute")
	
est restore ordinal_coup_c
 margins , atmeans dydx(humanitarian_treat_num) post
 eststo ordinal_coup_c_dydx, title("Coup")
 		
coefplot	(ordinal_contribute_c_dydx, label(Contribute))						///
			(ordinal_coup_c_dydx, label(Coup))									///
			(ordinal_threaten_c_dydx, label(Threaten))							///
	, recast(bar) vertical barw(0.25)											///
	ciopts(recast(rcap) color(gs8)) citop										///
			xlab(1 `""Strongly" "disapprove""' 2 "Disapprove"					/// 
			3 `""Somewhat" "disapprove""' 		4 "Neither" 					///
			5 `""Somewhat" "approve""' 6 "Approve" 7 `""Strongly" "approve""',	///
				labsize(tiny)) 													///
		title("{bf:C) Predicted Changes in Support}",						 	///
				size(medsmall)) yline(0) ylab(`myla',labsize(vsmall))			///
		subtitle("{it: Humanitarian Minus Interest}", size(small))				///
		name(gph_dydx_selected, replace)										///
		legend(rows(1) ring(2) pos(12)) 	
		
replace strategy = "Concession Before" if strategy == "negotiate"
replace strategy = "Concession After"  if strategy == "concession"
replace strategy = "Coup" if strategy == "coup"
replace strategy = "Threaten Sanctions" if strategy == "threaten"
replace strategy = "Contribute" if strategy == "contribute"

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Summary Plot
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
		
catplot  if humanitarian_treat_num == 1 										/// 
	, over(human_DV_trichot, label(labsize(*.65))) 							///
	over(strategy, label(labsize(2)))											///
	asyvars stack																///
	bar(1, bcolor(ebg)) bar(2, bcolor(dimgray)) 								///
	horizontal percent(strategy) 												///
	ytitle("Percent") 															///
	blabel(bar,format(%4.1f) size(2) position(center)) 							///
	legend(position(1) rows(1) size(vsmall)) 									///
	name(gph_catplot_humanitarian1,replace)										///
	title("{it:Humanitarian}", size(small))
	
	
catplot if humanitarian_treat_num == 0 											/// 
	, over(human_DV_trichot, label(labsize(*.65))) 								///
	over(strategy,label(labsize(2)))											///
	asyvars stack																///
	bar(1, bcolor(ebg)) bar(2, bcolor(dimgray)) 								///
	horizontal percent(strategy) 												///
	ytitle("Percent") 															///
	blabel(bar,format(%4.1f) size(2) position(center)) 							///
	legend(position(1) rows(1) size(vsmall))									///
	name(gph_catplot_humanitarian0,replace)										///
		title("{bf: A) Raw Support for Strategies}")							///	
	subtitle("{it:Interest}", size(small))
		

grc1leg gph_catplot_humanitarian0 gph_catplot_humanitarian1						///
	, rows(2) name(gph_combined_temp1, replace)								

gr combine ologitcoef_small gph_dydx_selected, rows(2) name(gph_combined_temp2, replace)

gr combine 	gph_combined_temp1  gph_combined_temp2								///
	, rows(1) name(gph_combined_ultimate_alt,replace)							
	
gr display, ysize(9) xsize(9)	

**********************
* Main Paper Figure 3

gr export "${MyProject}00 Main Figure 3.pdf", replace
